<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button name="on">点击</button>
    <script>
        //onclick 点击触发 keyup 键盘输入触发
   let btn=document.querySelector(`[name="on"]`);
//    console.log(btn);

//两种写法
    // btn.onclick=function(){
    //     alert("点击了，帅哥");
    // }
    // btn.addEventListener("click",()=>{
    //     alert('as')
    // });
    </script>
</body>
</html>